function FrontData(var dataName : Str255; windowType : Str255) : boolean;

Returns the active data window.  If windowType equals "data" then only the top data window will be returned, if windowType="text" then only the top text window will be returned, and if windowType equals "data+text" then either type will be returned.  If there are no windows open of the specified windowType then the empty string is returned and the function returns FALSE.

Also see:  SelectData  NextData  Exist